#include <hxcpp.h>

#ifndef INCLUDED_format_tools_Adler32
#include <format/tools/Adler32.h>
#endif
#ifndef INCLUDED_haxe_io_Bytes
#include <haxe/io/Bytes.h>
#endif
#ifndef INCLUDED_haxe_io_Input
#include <haxe/io/Input.h>
#endif
namespace format{
namespace tools{

Void Adler32_obj::__construct()
{
{
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",35)
	this->a1 = (int)1;
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",36)
	this->a2 = (int)0;
}
;
	return null();
}

Adler32_obj::~Adler32_obj() { }

Dynamic Adler32_obj::__CreateEmpty() { return  new Adler32_obj; }
hx::ObjectPtr< Adler32_obj > Adler32_obj::__new()
{  hx::ObjectPtr< Adler32_obj > result = new Adler32_obj();
	result->__construct();
	return result;}

Dynamic Adler32_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< Adler32_obj > result = new Adler32_obj();
	result->__construct();
	return result;}

Void Adler32_obj::update( ::haxe::io::Bytes b,int pos,int len){
{
		HX_SOURCE_PUSH("Adler32_obj::update")
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",40)
		int a1 = this->a1;
		int a2 = this->a2;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",41)
		{
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",41)
			int _g1 = pos;
			int _g = (pos + len);
			HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",41)
			while(((_g1 < _g))){
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",41)
				int p = (_g1)++;
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",42)
				int c = b->b->__get(p);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",43)
				a1 = hx::Mod(((a1 + c)),(int)65521);
				HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",44)
				a2 = hx::Mod(((a2 + a1)),(int)65521);
			}
		}
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",46)
		this->a1 = a1;
		HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",47)
		this->a2 = a2;
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC3(Adler32_obj,update,(void))

bool Adler32_obj::equals( ::format::tools::Adler32 a){
	HX_SOURCE_PUSH("Adler32_obj::equals")
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",50)
	return (bool((a->a1 == this->a1)) && bool((a->a2 == this->a2)));
}


HX_DEFINE_DYNAMIC_FUNC1(Adler32_obj,equals,return )

::format::tools::Adler32 Adler32_obj::read( ::haxe::io::Input i){
	HX_SOURCE_PUSH("Adler32_obj::read")
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",55)
	::format::tools::Adler32 a = ::format::tools::Adler32_obj::__new();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",56)
	int a2a = i->readByte();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",57)
	int a2b = i->readByte();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",58)
	int a1a = i->readByte();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",59)
	int a1b = i->readByte();
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",60)
	a->a1 = (int((int(a1a) << int((int)8))) | int(a1b));
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",61)
	a->a2 = (int((int(a2a) << int((int)8))) | int(a2b));
	HX_SOURCE_POS("/usr/lib/haxe/lib/format/1,22/format/tools/Adler32.hx",62)
	return a;
}


STATIC_HX_DEFINE_DYNAMIC_FUNC1(Adler32_obj,read,return )


Adler32_obj::Adler32_obj()
{
}

void Adler32_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(Adler32);
	HX_MARK_MEMBER_NAME(a1,"a1");
	HX_MARK_MEMBER_NAME(a2,"a2");
	HX_MARK_END_CLASS();
}

void Adler32_obj::__Visit(HX_VISIT_PARAMS)
{
	HX_VISIT_MEMBER_NAME(a1,"a1");
	HX_VISIT_MEMBER_NAME(a2,"a2");
}

Dynamic Adler32_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 2:
		if (HX_FIELD_EQ(inName,"a1") ) { return a1; }
		if (HX_FIELD_EQ(inName,"a2") ) { return a2; }
		break;
	case 4:
		if (HX_FIELD_EQ(inName,"read") ) { return read_dyn(); }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"update") ) { return update_dyn(); }
		if (HX_FIELD_EQ(inName,"equals") ) { return equals_dyn(); }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic Adler32_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 2:
		if (HX_FIELD_EQ(inName,"a1") ) { a1=inValue.Cast< int >(); return inValue; }
		if (HX_FIELD_EQ(inName,"a2") ) { a2=inValue.Cast< int >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void Adler32_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("a1"));
	outFields->push(HX_CSTRING("a2"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	HX_CSTRING("read"),
	String(null()) };

static ::String sMemberFields[] = {
	HX_CSTRING("a1"),
	HX_CSTRING("a2"),
	HX_CSTRING("update"),
	HX_CSTRING("equals"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
};

static void sVisitStatics(HX_VISIT_PARAMS) {
	HX_VISIT_MEMBER_NAME(Adler32_obj::__mClass,"__mClass");
};

Class Adler32_obj::__mClass;

void Adler32_obj::__register()
{
	Static(__mClass) = hx::RegisterClass(HX_CSTRING("format.tools.Adler32"), hx::TCanCast< Adler32_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics, sVisitStatics);
}

void Adler32_obj::__boot()
{
}

} // end namespace format
} // end namespace tools
